<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: zhouzixiong1
  Date: 2017/8/28
  Time: 16:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>新用户注册</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link href="../../statics/css/bootstrap.min.css" rel="stylesheet">
    <link href="../../statics/css/style.css" rel="stylesheet">
    <link href="../../statics/css/ASignInNormalUser.css" rel="stylesheet">
    <link href="../../statics/css/ATopMenu.css" rel="stylesheet">
    <script src="../../statics/js/jquery-3.0.0.js"></script>
    <script src="../../statics/js/layer.js"></script>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="title aTopMenu">新用户注册</div>
    </div>
    <div class="row">
        <c:import url="common/ATopMenu.jsp"></c:import>
    </div>
    <div class="row">
        <div class="col-sm-8 col-sm-push-2">
            <div class="col-sm-4 label">用户名：</div>
            <div class="col-sm-8"><input class="form-control" name="userName" id="userName" placeholder="请输入用户名"></div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-8 col-sm-push-2">
            <div class="col-sm-4 label">密&nbsp;码：</div>
            <div class="col-sm-8"><input  class="form-control" name="password" id="password" placeholder="请输入密码"></div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-8 col-sm-push-2">
            <div class="col-sm-4 label">邮&nbsp;箱：</div>
            <div class="col-sm-8"><input class="form-control" name="email" id="email" placeholder="请输入邮箱"></div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-8 col-sm-push-2">
            <div class="col-sm-4 label">电&nbsp;话：</div>
            <div class="col-sm-8"><input class="form-control" name="phone" id="phone" placeholder="请输入手机号"></div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-8 col-sm-push-2">
            <div class="col-sm-4 label">充值金额：</div>
            <div class="col-sm-8"><input class="form-control" name="money" id="money" placeholder="请输入充值金额(精确到分，例：100.00)"></div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-8 col-sm-push-2">
            <div class="col-sm-4 label">是否加入会员</div>
            <div class="col-sm-8">
                <div class="checkbox">
                    <label><input type="checkbox" name="isMember" id="isMember">"是"请打勾</label>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-8 col-sm-push-2">
            <div class="col-sm-4 label">会员卡号：</div>
            <div class="col-sm-8"><input class="form-control" name="cardNum" id="cardNum" placeholder="如果不是会员不用填写"></div>
        </div>
    </div>
    <div class="row" style="text-align: center">
        <button class="btn btn-info"  onclick="signIn()">注册新用户</button>
    </div>
</div>
<script type="text/javascript">
    document.getElementById("MenuASignInNormalUser").className = "active";
//    window.onload = signIn();
    function signIn() {
        var signIn = {
            userName : $("#userName").val(),
            password : $("#password").val(),
            email : $("#email").val(),
            phone : $("#phone").val(),
            money : $("#money").val(),
            isMember : $("#isMember").val()=="on",
            memberCard : $("#cardNum").val()
        };
        $.ajax({
            type : 'post',
            url : '/NormalUser/normalUserSignIn',
            data : JSON.stringify(signIn),
            contentType:'application/json',
            dataType : 'json',
            success : function (data) {
                console.log(data.code);
                if(data.code!="0"){
                    layer.msg(data.message);
                }
                else {
                    layer.msg(data.data);
                }

                return;
            },
            error:function (data) {
                layer.msg("系统异常请重试或联系管理员");
            }
        })
    }
</script>
</body>
</html>
